package priv.wangy.micro.common.po.valid;

import jakarta.validation.Constraint;
import jakarta.validation.Payload;
import priv.wangy.micro.common.po.valid.validator.ZhAndEnValidator;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * 中文、英文、数字、中英文标点
 *
 * @author 张嘉琪
 * @since 2023-04-09
 */
@Target({ElementType.FIELD, ElementType.PARAMETER})
@Retention(RetentionPolicy.RUNTIME)
@Constraint(validatedBy = ZhAndEnValidator.class)
public @interface ZhAndEn {

    String message() default "不符合中英文通用输入限制";

    ZhAndEnValidator.ZhAndEnPattern mode() default ZhAndEnValidator.ZhAndEnPattern.FULL;

    int min();

    int max();

    Class<?>[] groups() default {};

    Class<? extends Payload>[] payload() default {};

    @Target({ElementType.FIELD, ElementType.PARAMETER})
    @Retention(RetentionPolicy.RUNTIME)
    @interface List {
        ZhAndEn[] value();
    }
}
